<div id="page-body">
  <p>
    The date picker will throw errors for a number of different reason. Most errors are related to an invalid setup.
  </p>
  <p>
    Except where noted, the thrown errors are a type of <code>TdError</code> that extends the base javascript <code>Error</code>
    class.
  </p>
  <p>
    Where indicated the error provides a code value so that a developer can check for this value.
  </p>

  <div class='row'>
    <h2 id='unexpectedOption'>unexpectedOption <small>(code: 1)</small><a class='anchor-link ' aria-label='Anchor'
                                                                          href='#unexpectedOption'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error indicating that a key in the options object is invalid.
    </p>
  </div>

  <div class='row'>
    <h2 id='unexpectedOptions'>unexpectedOptions <small>(code: 1)</small><a class='anchor-link ' aria-label='Anchor'
                                                                            href='#unexpectedOptions'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error indicating that one more keys in the options object is invalid.
    </p>
  </div>

  <div class='row'>
    <h2 id='unexpectedOptionValue'>unexpectedOptionValue <small>(code: 2)</small><a class='anchor-link '
                                                                                    aria-label='Anchor'
                                                                                    href='#unexpectedOptionValue'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error when an option is provide an unsupported value. For example a value of 'cheese' for toolbarPlacement
      which only supports 'top', 'bottom', 'default'.
    </p>
  </div>

  <div class='row'><h2 id='typeMismatch'>typeMismatch <small>(code: 3)</small><a class='anchor-link ' aria-label='Anchor'
                                                                  href='#typeMismatch'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error when an option value is the wrong type.
      For example a string value was provided to multipleDates which only
      supports true or false.
    </p>
  </div>

  <div class='row'><h2 id='numbersOutOfRage'>numbersOutOfRage <small>(code: 4)</small><a class='anchor-link ' aria-label='Anchor'
                                                                          href='#numbersOutOfRage'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error when an option value is outside of the expected range.
      For example <code>restrictions.daysOfWeekDisabled</code> excepts a value between 0 and 6.
    </p>
  </div>

  <div class='row'>
    <h2 id='failedToParseDate'>failedToParseDate <small>(code: 5)</small><a class='anchor-link ' aria-label='Anchor'
                                                                            href='#failedToParseDate'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error when a value for a date options couldn't be parsed. Either
      the option was an invalid string or an invalid Date object.
    </p>
  </div>

  <div class='row'>
    <h2 id='mustProvideElement'>mustProvideElement <small>(code: 6)</small><a class='anchor-link ' aria-label='Anchor'
                                                                              href='#mustProvideElement'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error when an element to attach to was not provided in the constructor.
    </p>
  </div>

  <div class='row'>
    <h2 id='subscribeMismatch'>subscribeMismatch <small>(code: 7)</small><a class='anchor-link ' aria-label='Anchor'
                                                                            href='#subscribeMismatch'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      An error if providing an array for the events to subscribe method doesn't have
      the same number of callbacks. E.g., subscribe([1,2], [1])
    </p>
  </div>

  <div class='row'>
    <h2 id='conflictingConfiguration'>conflictingConfiguration <small>(code: 8)</small><a class='anchor-link '
                                                                                          aria-label='Anchor'
                                                                                          href='#conflictingConfiguration'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      The configuration has conflicting rules e.g. minDate is after maxDate
    </p>
  </div>

  <div class='row'>
    <h2 id='dateString'>dateString<a class='anchor-link ' aria-label='Anchor' href='#dateString'><i
      class="fa-solid fa-anchor" aria-hidden="true"></i></a></h2>
    <p>
      Logs a warning if a date option value is provided as a string, instead of
      a date/datetime object.
    </p>
  </div>

  <div class='row'>
    <h2 id='errorMessages'>Error Messages</h2>
    <div class='row'>
      <div class='col offset-1 border-start'>
        <h3 id='failedToSetInvalidDate'>failedToSetInvalidDate<a class='anchor-link ' aria-label='Anchor'
                                                                 href='#failedToSetInvalidDate'><i
          class="fa-solid fa-anchor" aria-hidden="true"></i></a></h3>
        <p>
          Used with an <a href='events.html#error'>Error Event type</a> if the user selects a date that fails
          restriction
          validation.
        </p>

        <h3 id='failedToParseInput'>failedToParseInput<a class='anchor-link ' aria-label='Anchor'
                                                         href='#failedToParseInput'><i
          class="fa-solid fa-anchor" aria-hidden="true"></i></a></h3>
        <p>
          Used with an <a href='events.html#error'>Error Event type</a> when a user changes the value of the input field
          directly, and does not provide a valid date.
        </p>
      </div>
    </div>
  </div>

  <div id='subToc' class='d-none'>
    <nav id='TableOfContents'>
      <ul>
        <li><a href='#unexpectedOption'>UnexpectedOption</a></li>
        <li><a href='#unexpectedOptions'>UnexpectedOptions</a></li>
        <li><a href='#unexpectedOptionValue'>UnexpectedOptionValue</a></li>
        <li><a href='#typeMismatch'>TypeMismatch</a></li>
        <li><a href='#numbersOutOfRage'>NumbersOutOfRage</a></li>
        <li><a href='#failedToParseDate'>FailedToParseDate</a></li>
        <li><a href='#mustProvideElement'>MustProvideElement</a></li>
        <li><a href='#subscribeMismatch'>SubscribeMismatch</a></li>
        <li><a href='#conflictingConfiguration'>ConflictingConfiguration</a></li>
        <li><a href='#dateString'>DateString</a></li>
        <li><a href='#errorMessages'>Error Messages</a>
        <ul>
          <li><a href='#failedToSetInvalidDate'>FailedToSetInvalidDate</a></li>
          <li><a href='#failedToParseInput'>FailedToParseInput</a></li>
        </ul>
        </li>
      </ul>
    </nav>
  </div>

</div>

<div id="page-meta">
  <div id="title">Errors</div>
  <div id="post-date">07/08/2021</div>
  <div id="update-date">07/08/2021</div>
  <div id="excerpt">Overview of the errors thrown and error messages from Tempus Dominus.</div>
  <div id="tags">datepicker, javascript, open source, tempus dominus, eonasdan</div>
</div>
